perm filename SAMPLE.PAS[TEX,DEK] blob
sn#427781 filedate 1979-03-24 generic text, type T, neo UTF8
type inflnk = packed record info: 0..131071; link: 0..32767 end;
token = packed record cmd: 0..15; chr: 0..1023 end;
toklnk = packed record tok: token; link: 0..32767 end;
eqtbval = packed record idcmd: 0..127; idlev: 0..31; idlen: 0..7;
link: 0..32767 end;
tracebits = packed record mmm:0..511; nnn: 0..511; ddtflag: 0..1; inputflag: 0..1;
replflag: 0..1; dumpflag: 0..1; detailflag: 0..1; overflag: 0..1 end;
ee = record case 1..4 of
1: (eq: eqtbval);
2: (int: integer);
3: (pts: real);
4: (tr: tracebits)
end;
mm = record case 1..5 of
1: (pts: real);
2: (int: integer);
3: (il: inflnk);
4: (tl: toklnk);
5: (something_else_probably_too)
end;
var mem = array 0..memsize-1 of mm;
eqtb = array 0..618 of ee;
Here's an example of a macro with a parameter:}}
procedure get_next; label 1, 2, 3; var t: token; tt: toklnk;
begin
1:
if state <> 0 then if curbuf < instack_ptr then begin begin curchar := ord(instack[instack_ptr]);
instack_ptr := instack_ptr + 1;
curcmd := eqtb[curchar+481].int
end
;
case state + curcmd of
10, 23,
24, 36, 37
:goto 3;
1, 14,
27
:begin control_seq;
with eqtb[hashentry].eq do
begin curcmd_idcmd; curchar_link
end;
state_skipblanks
end
;
11: begin state := 14;
curchar := ord(' ')
end
;
6: begin state := 27;
curbuf := instack_ptr; curcmd := 10;
curchar := ord(' ')
end
;
19: begin state := 27;
curbuf := instack_ptr; goto 3
end
;
2: alignstate := alignstate + 1;
15, 28: begin state := 1;
alignstate := alignstate + 1
end
;
3: alignstate := alignstate -1;
16, 29: begin state := 1;
alignstate := alignstate - 1
end
;
17, 18,
20, 21, 22, 25,
26, 30, 31, 33,
38, 39
:state := 1
;
others:
end
end
else begin begin if filename <> 0 then begin inputln; if eoff then begin write(')'); release(loc); if page_warning <> OK then page_end_error
;
popinput; curcmd := 13; curchar := 0;
goto 2
end
;
if eqtb[trace_offset].tr.inputflag then
begin println;
for curbuf := inbuf to instack_ptr-1 do write(instack[curbuf]);
begin println; print('*'); inputln;
for curbuf := inbuf to instack_ptr-1 do write(instack[curbuf])
;
if (escapechar<0) and (ord(instack[inbuf])<>13) then
begin escapechar := ord(instack[inbuf]);
eqtb[escapechar+481].int
:= 0;
end
;
end
;
end
;
with recovery do
if brchar = 12 then begin info := info + 1; print(' '); print(info); link := 0; if page_warning <> OK then page_end_error
end
else link := link + 1
end
else if inptr <> 0 then begin popinput; goto 1
end
else begin println; print('*'); inputln;
for curbuf := inbuf to instack_ptr-1 do write(instack[curbuf])
;
if (escapechar<0) and (ord(instack[inbuf])<>13) then
begin escapechar := ord(instack[inbuf]);
eqtb[escapechar+481].int
:= 0;
end
;
end
;
curbuf := inbuf end
;
goto 3
end
else if loc <> 0 then begin begin tt := mem[loc].tl;
with tt do
begin t := tok; loc := link curchar := t.chr;
curcmd := t.cmd;
end
end
;
case curcmd of
0 :begin hashentry := curchar;
with eqtb[curchar].eq do
begin curcmd := idcmd; curchar := link
end
end
;
outpar : begin pushinput; with recovery do
begin loc := parstack[link + curchar]; info := 0;
link := loc; goto 1 end
end
;
1 : alignstate := alignstate + 1;
2 : alignstate := alignstate - 1;
others:
end
end
else begin case recovery.info of
0, 2: ;
1: alignstate := 0; 3: dslist(recovery); others: with recovery do
begin delrclink(info); while parptr>link do
begin parptr := parptr-1;
dslist(parstack[parptr]) end
end
end
;
popinput; goto 1
end
;
if alignstate = 0 and ((curcmd=4) or (curcmd=5))
then
begin align_insert;
hashentry := -1; goto 1
end
;
2:
end